// 组件声明周期

import React from "react"
import ReactDOM from "react-dom"
// class Count extends ReactDOM.Component {
//     render() {
//         console.warn("子组件")
//         return <h1>统计豆豆打击次数: {this.props.count}</h1>
//     }
// }
class Zujian extends React.Component {


    constructor(props) {
        super(props);
        this.state = {
            count : 0
        }
        console.warn('生命周期 constractor')
    }
    handeState = () => {
        this.setState({
            count:this.state.count + 1
        })
    }
    componentDidMount() {
        console.warn('生命周期 componentDidMount')
    }

    render() {
        console.warn('生命周期 render')
        return (
            <div>
                {/*{*/}
                {/*    this.state.count > 3 ? <h1>统计豆豆打击次数: {this.state.count}</h1> : <h1>统计豆豆打击次数: 打死了</h1>*/}
                {/*}*/}
                <h1>统计豆豆打击次数: {this.state.count}</h1>
                {/*<Count count = {this.state.count}/>*/}
                <button id="btn" onClick={this.handeState}>打豆豆</button>
            </div>
        );
    }
}

export default Zujian
